import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

from selenium.webdriver.support.ui import WebDriverWait as Ec
from selenium.webdriver.support.wait import WebDriverWait
from ddt import ddt,file_data

@ddt
#Ngqyabdsctyocigf qq授权码
@file_data('jx.yaml')
class Testcase2():
    driver = webdriver.Chrome()
    driver.get('https://www.jiuxian.com/')
    driver.maximize_window()
    driver.find_element(By.XPATH,'/html/body/div[2]/div/div[1]/div/a[1]').click()
    time.sleep(3)
    dy1 = driver.find_element(By.XPATH,'//*[@id="loginform"]/div/div/div/div/div[1]/div[1]/a[1]').text
    print('文本断言1',dy1)
    assert dy1 ==  '帐号登录'
    driver.find_element(By.NAME,'uname').send_keys('18615488780')
    driver.find_element(By.NAME,'_pwd').send_keys('lr123456.')
    time.sleep(10)
    driver.find_element(By.XPATH,'//*[@id="save"]').click()
    time.sleep(2)
    driver.find_element(By.XPATH,'//*[@id="bindSub"]').click()
    time.sleep(5)
    driver.find_element(By.XPATH,'//*[@id="wd"]').send_keys('五粮液')
    driver.find_element(By.XPATH,'/html/body/div[4]/div/div[2]/div[1]/form/input[2]').click()

    dy2 = driver.find_element(By.XPATH, '/html/body/div[6]/div/div[2]/div[5]/ul/li[1]/div[2]/div[3]/a').text
    print('文本断言2', dy2)
    assert dy2 == '52°第八代五粮液 普五 500ml 浓香大标品'
    driver.find_element(By.XPATH,'//*[@id="addcart_88665"]/a').click()
    time.sleep(3)